<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [];
        for(var i = 0;i < 10;i++){
            // arr = i;不要直接给数组名赋值 否则以前的元素就没了
            arr[i] = i + 1;
        }
        console.log(arr);
    </script>
</head>
<body>
    
</body>
</html>